/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.message.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.chlitina.store.modules.base.entity.Customer;
import com.chlitina.store.modules.cash.entity.StoreReserve;
import com.chlitina.store.modules.employee.entity.Employee;
import com.chlitina.store.modules.sys.entity.Store;

/**
 * 员工任务单Entity
 * @author lvbo
 * @version 2013-11-09
 */
@Entity
@Table(name = "store_employee_task")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class StoreEmployeeTask extends BaseEntity {
	
	public static final int STATUS_VIEWED = 1;
	public static final int STATUS_NOT_VIEWED = 0;
	public static final int STATUS_COMPLETED = 1;
	public static final int STATUS_NOT_COMPLETED = 0;
	public static final int TYPE_PRODUCT_OR_CARE = 0;
	public static final int TYPE_STORE_RESEVER = 1;
	public static final int TYPE_CUSTOMER_DEVELOPER = 2;
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private Store store; 	// 店面
	private Employee employee; //员工
	private Customer customer; //客户
	private Date taskDate;	// 任务的下达时间
	private int type;	// 任务单类型	0：产品及护理提醒跟踪任务单 1：预约登记任务单 2：客户开发任务单
	private int viewed;	// 任务单是否被查看	0：未被查看	1：已被查看
	private int completed;	// 任务单是否已完成	0：未完成 1：已完成
	private String taskContent;	// 任务明细
	private StoreReserve storeReserve;	//客户预约

	public StoreEmployeeTask() {
		this.viewed = STATUS_NOT_VIEWED;
		this.completed = STATUS_NOT_COMPLETED;
	}

	public StoreEmployeeTask(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_message_storeEmployeeTask")
	//@SequenceGenerator(name = "seq_message_storeEmployeeTask", sequenceName = "seq_message_storeEmployeeTask")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="store_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="employee_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="customer_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}
	
	@Column(name="task_date")
	public Date getTaskDate() {
		return taskDate;
	}

	public void setTaskDate(Date taskDate) {
		this.taskDate = taskDate;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public int getViewed() {
		return viewed;
	}

	public void setViewed(int viewed) {
		this.viewed = viewed;
	}

	public int getCompleted() {
		return completed;
	}

	public void setCompleted(int completed) {
		this.completed = completed;
	}

	@Column(name="task_content")
	public String getTaskContent() {
		return taskContent;
	}
	
	public void setTaskContent(String taskContent) {
		this.taskContent = taskContent;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="store_reserve_id")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public StoreReserve getStoreReserve() {
		return storeReserve;
	}

	public void setStoreReserve(StoreReserve storeReserve) {
		this.storeReserve = storeReserve;
	}

	
}


